//
//  UIButton+NED.h
//  MoreCoin
//
//  Created by 林宁宁 on 2019/11/7.
//  Copyright © 2019 MoreCoin. All rights reserved.
//


#import <UIKit/UIKit.h>

typedef void (^_Nullable TouchedBlock)(UIButton * _Nullable sender, NSInteger tag);

typedef NS_ENUM(NSInteger, NEDImagePosition) {
    NEDImagePositionLeft     = 1 << 0,            //图片在左，文字在右，默认
    NEDImagePositionRight    = 1 << 1,            //图片在右，文字在左
    NEDImagePositionTop      = 1 << 2,            //图片在上，文字在下
    NEDImagePositionBottom   = 1 << 3,            //图片在下，文字在上
    NEDImagePositionLeftRightFill = 1 << 4,           //图片左右填充
};


NS_ASSUME_NONNULL_BEGIN

@interface UIButton (NED)

/**
 *  @brief  设置按钮额外热区
 */
@property (nonatomic, assign) UIEdgeInsets ned_touchAreaInsets;

-(void)addActionHandler:(TouchedBlock)touchHandler;
/// 设置title
-(void)ned_setTitleNormal:(NSString *)title;
-(void)ned_setTitleSelected:(NSString *)title;

/**
 *  利用UIButton的titleEdgeInsets和imageEdgeInsets来实现文字和图片的自由排列
 *  注意：这个方法需要在设置图片和文字之后才可以调用，且button的大小要大于 图片大小+spacing
 *
 *  @param spacing 图片和文字的间隔
 */
- (void)setImagePosition:(NEDImagePosition)postion spacing:(CGFloat)spacing;

 
@end

NS_ASSUME_NONNULL_END
